Class java.awt.FileDialog
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.FileDialog

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Window
                           |
                           +----Dialog
                                   |
                                   +----java.awt.FileDialog

public class FileDialog
extends Dialog
The FileDialog class displays a dialog window from which the user can select a file.

Since it is a modal dialog, when the application calls its show method to display the dialog, it blocks the rest of the application until the user has chosen a file.

Version:
1.32, 07/01/98
Author:
Sami Shaio, Arthur van Hoff
Since:
JDK1.0
See Also:
show

Variable Index

 o LOAD
This constant value indicates that the purpose of the file dialog window is to locate a file from which to read.
 o SAVE
This constant value indicates that the purpose of the file dialog window is to locate a file to which to write.

Constructor Index

 o java.awt.FileDialog(Frame)
Creates a file dialog for loading a file.
 o java.awt.FileDialog(Frame, String)
Creates a file dialog window with the specified title for loading a file.
 o java.awt.FileDialog(Frame, String, int)
Creates a file dialog window with the specified title for loading or saving a file.

Method Index

 o addNotify()
Creates the file dialog's peer.
 o getDirectory()
Gets the directory of this file dialog.
 o getFile()
Gets the selected file of this file dialog.
 o getFilenameFilter()
Determines this file dialog's filename filter.
 o getMode()
Indicates whether this file dialog box is for loading from a file or for saving to a file.
 o paramString()
Returns the parameter string representing the state of this file dialog window.
 o setDirectory(String)
Sets the directory of this file dialog window to be the specified directory.
 o setFile(String)
Sets the selected file for this file dialog window to be the specified file.
 o setFilenameFilter(FilenameFilter)
Sets the filename filter for this file dialog window to the specified filter.
 o setMode(int)
Sets the mode of the file dialog.

Variables

 o LOAD
public static final int LOAD
This constant value indicates that the purpose of the file dialog window is to locate a file from which to read.

Since: JDK1.0
 o SAVE
public static final int SAVE
This constant value indicates that the purpose of the file dialog window is to locate a file to which to write.

Since: JDK1.0

Constructors

 o FileDialog
public FileDialog(Frame parent)
Creates a file dialog for loading a file. The title of the file dialog is initially empty.

Parameters:
parent - the owner of the dialog
Since:
JDK1.1
 o FileDialog
public FileDialog(Frame parent,
                  String title)
Creates a file dialog window with the specified title for loading a file. The files shown are those in the current directory.

Parameters:
parent - the owner of the dialog.
title - the title of the dialog.
Since:
JDK1.0
 o FileDialog
public FileDialog(Frame parent,
                  String title,
                  int mode)
Creates a file dialog window with the specified title for loading or saving a file.

If the value of mode is LOAD, then the file dialog is finding a file to read. If the value of mode is SAVE, the file dialog is finding a place to write a file.

Parameters:
parent - the owner of the dialog.
title - the title of the dialog.
mode - the mode of the dialog.
Since:
JDK1.0
See Also:
LOAD, SAVE

Methods

 o addNotify
public void addNotify()
Creates the file dialog's peer. The peer allows us to change the look of the file dialog without changing its functionality.

Overrides:
addNotify in class Dialog
 o getDirectory
public java.lang.String getDirectory()
Gets the directory of this file dialog.

Returns:
the directory of this file dialog.
Since:
JDK1.0
See Also:
setDirectory
 o getFile
public java.lang.String getFile()
Gets the selected file of this file dialog.

Returns:
the currently selected file of this file dialog window, or null if none is selected.
Since:
JDK1.0
See Also:
setFile
 o getFilenameFilter
public java.io.FilenameFilter getFilenameFilter()
Determines this file dialog's filename filter. A filename filter allows the user to specify which files appear in the file dialog window.

Returns:
this file dialog's filename filter.
Since:
JDK1.0
See Also:
FilenameFilter, setFilenameFilter
 o getMode
public int getMode()
Indicates whether this file dialog box is for loading from a file or for saving to a file.

Returns:
the mode of this file dialog window, either FileDialog.LOAD or FileDialog.SAVE.
Since:
JDK1.0
See Also:
LOAD, SAVE, setMode
 o paramString
protected java.lang.String paramString()
Returns the parameter string representing the state of this file dialog window. This string is useful for debugging.

Returns:
the parameter string of this file dialog window.
Overrides:
paramString in class Dialog
Since:
JDK1.0
 o setDirectory
public void setDirectory(String dir)
Sets the directory of this file dialog window to be the specified directory.

Parameters:
dir - the specific directory.
Since:
JDK1.0
See Also:
getDirectory
 o setFile
public void setFile(String file)
Sets the selected file for this file dialog window to be the specified file. This file becomes the default file if it is set before the file dialog window is first shown.

Parameters:
file - the file being set.
Since:
JDK1.0
See Also:
getFile
 o setFilenameFilter
public synchronized void setFilenameFilter(FilenameFilter filter)
Sets the filename filter for this file dialog window to the specified filter.

Parameters:
filter - the specified filter.
Since:
JDK1.0
See Also:
FilenameFilter, getFilenameFilter
 o setMode
public void setMode(int mode)
Sets the mode of the file dialog.

Parameters:
mode - the mode for this file dialog, either FileDialog.LOAD or FileDialog.SAVE.
Throws: IllegalArgumentException
if an illegal file dialog mode is used.
Since:
JDK1.1
See Also:
LOAD, SAVE, getMode

All Packages  Class Hierarchy  This Package  Previous  Next  Index